using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using MapControl.Misc;
using MapControl.Properties;
using MapXLib;

namespace MapControl
{
    public partial class ucToolStrip : UserControl
    {
        

        private ucMap mapControl;
        private AxMapXLib.AxMap AxMap1;
        

        public ucToolStrip(ucMap map)
        {
            InitializeComponent();
            mapControl = map;
            AxMap1 = mapControl.Map;
        }

        private void ucToolStrip_Load(object sender, EventArgs e)
        {
            ToolStripSetup();
        }

        private ImageList imgList = new ImageList();
        public void ToolStripSetup()
        {
            imgList.ImageSize = new Size(18, 16);
            imgList.ColorDepth = ColorDepth.Depth4Bit;
            imgList.TransparentColor = Color.FromArgb(192, 192, 192);

            imgList.Images.AddStrip(Resources.buttons);

            toolStripButtonSelectTool.Image = imgList.Images[9];
            toolStripButtonPanTool.Image = imgList.Images[18];
            toolStripButtonZoomIn.Image = imgList.Images[15];
            toolStripButtonZoomOut.Image = imgList.Images[16];
            toolStripButtonDistance.Image = imgList.Images[31];
            toolStripButtonAllLayersView.Image = imgList.Images[32];
        }

        private void toolStripButtonSelectTool_Click(object sender, EventArgs e)
        {
            AxMap1.CurrentTool = MapXLib.ToolConstants.miArrowTool;
            mapControl.ActiveTool = DrawToolType.None;
        }

        private void toolStripButtonPanTool_Click(object sender, EventArgs e)
        {
            AxMap1.CurrentTool = MapXLib.ToolConstants.miPanTool;
            mapControl.ActiveTool = DrawToolType.None;
        }

        private void toolStripButtonZoomIn_Click(object sender, EventArgs e)
        {
            AxMap1.CurrentTool = MapXLib.ToolConstants.miZoomInTool;
            mapControl.ActiveTool = DrawToolType.None;
        }

        private void toolStripButtonZoomOut_Click(object sender, EventArgs e)
        {
            AxMap1.CurrentTool = MapXLib.ToolConstants.miZoomOutTool;
            mapControl.ActiveTool = DrawToolType.None;
        }

        private void toolStripButtonDistance_Click(object sender, EventArgs e)
        {
            AxMap1.CurrentTool = ToolConstants.miArrowTool;
            mapControl.ActiveTool = DrawToolType.Distance;
        }

        private void toolStripButtonAllLayersView_Click(object sender, EventArgs e)
        {
            AxMap1.ZoomTo(3206118, 106.9284196519465, 16.07934787370213);
        }

        private void toolStripButtonLatestGPS_Click(object sender, EventArgs e)
        {
            if (GeneralClass.currGPSData != null)
            {
                AxMap1.ZoomTo(AxMap1.Zoom, GeneralClass.currGPSData.objGPSData.LonGPS, GeneralClass.currGPSData.objGPSData.LatGPS);
            }
        }

       
    }
}
